<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>用户列表</title>
    <link rel="stylesheet" href="{{ url_for('static',filename='layui/css/layui.css') }}">
    <script type="text/javascript" src="{{ url_for('static',filename='jquery/jquery-3.5.1.min.js') }}"></script>
    <script type="text/javascript">
        //打印列表
        $(function() {
            $.ajax({
                url:"getUserInfo",
                method:"get",
                success:function(result) {
                    {# json字符串改json对象 #}
                    jsonObj=JSON.parse(result);
                    var str="";
                    $.each(jsonObj,function(index,row) {
                        if(row[6]!=1)
                            str+="<tr><td>"+(index+1)+"</td><td>"+row[1]+"</td><td>"+row[3]+"</td><td>"+row[4]+"</td><td>"+row[5]+
                                "</td><td>"+row[6]+"</td><td><a href='/PowerUpdate?id="+row[0]+"' class='layui-btn'><span class='layui-icon layui-icon-edit'>"+
                                "</span>权限修改</a>&emsp;&emsp;<a href='/UserDelete?id="+row[0]+"' class='layui-btn'><span class='layui-icon layui-icon-delete'>"+
                                "</span>删除</a></td></tr>"
                        else
                            str+="<tr><td id='uid' name='uid'>"+(index+1)+"</td><td id='uname' name='uname'>"+row[1]+"</td><td>"+row[3]+"</td><td>"+row[4]+"</td><td>"+row[5]+
                                "</td><td>"+row[6]+"</td><td><a href='/PowerUpdate?id="+row[0]+"' class='layui-btn'><span class='layui-icon layui-icon-edit'>"+
                                "</span>权限修改</a></td></tr>"
                        $("#tbody").html(str);
                    });

                },
                error:function (e) {
                    layer.msg("没有权限", {
                        time: 3000,
                        icon: 2
                    });
                }
            });
        });

    </script>
</head>
<body>
<div class="layui-elem-quote">
    用户列表
</div>
<form method="post" id="ulist" name="uliat">
<table class="layui-table">
    <tr>
        <th>id</th>
        <th>用户名</th>
        <th>性别</th>
        <th>邮箱</th>
        <th>手机</th>
        <th>权限</th>
        <th>操作</th>
    </tr>
    <tbody id="tbody">

    </tbody>
</table>
</form>

<script src="{{ url_for('static',filename='layui/layui.js') }}"></script>
<script>
    //JavaScript代码区域
    layui.use('element', function(){
        var element = layui.element;

    });
</script>
</body>
</html>